﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Rendering.ShadowDrawingSettings
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;
using UnityEngine.Scripting;

#nullable disable
namespace UnityEngine.Rendering
{
  /// <summary>
  ///   <para>Settings for ScriptableRenderContext.DrawShadows.</para>
  /// </summary>
  [UsedByNativeCode]
  public struct ShadowDrawingSettings : IEquatable<ShadowDrawingSettings>
  {
    private CullingResults m_CullingResults;
    private int m_LightIndex;
    private int m_UseRenderingLayerMaskTest;
    private ShadowSplitData m_SplitData;
    private ShadowObjectsFilter m_ObjectsFilter;

    /// <summary>
    ///   <para>Culling results to use.</para>
    /// </summary>
    public CullingResults cullingResults
    {
      get => this.m_CullingResults;
      set
      {
        this.m_CullingResults.Validate();
        this.m_CullingResults = value;
      }
    }

    /// <summary>
    ///   <para>The index of the shadow-casting light to be rendered.</para>
    /// </summary>
    public int lightIndex
    {
      get => this.m_LightIndex;
      set => this.m_LightIndex = value;
    }

    /// <summary>
    ///   <para>Set this to true to make Unity filter Renderers during shadow rendering. Unity filters Renderers based on the Rendering Layer Mask of the Renderer itself, and the Rendering Layer Mask of each shadow casting Light.</para>
    /// </summary>
    public bool useRenderingLayerMaskTest
    {
      get => this.m_UseRenderingLayerMaskTest != 0;
      set => this.m_UseRenderingLayerMaskTest = value ? 1 : 0;
    }

    /// <summary>
    ///   <para>The split data.</para>
    /// </summary>
    public ShadowSplitData splitData
    {
      get => this.m_SplitData;
      set => this.m_SplitData = value;
    }

    /// <summary>
    ///   <para>Specifies the filter Unity applies to GameObjects that it renders in the shadow pass.</para>
    /// </summary>
    public ShadowObjectsFilter objectsFilter
    {
      get => this.m_ObjectsFilter;
      set => this.m_ObjectsFilter = value;
    }

    /// <summary>
    ///   <para>Create a shadow settings object.</para>
    /// </summary>
    /// <param name="cullResults">The cull results for this light.</param>
    /// <param name="lightIndex">The light index.</param>
    /// <param name="cullingResults"></param>
    public ShadowDrawingSettings(CullingResults cullingResults, int lightIndex)
    {
      this.m_CullingResults = cullingResults;
      this.m_LightIndex = lightIndex;
      this.m_UseRenderingLayerMaskTest = 0;
      this.m_SplitData = new ShadowSplitData();
      this.m_SplitData.shadowCascadeBlendCullingFactor = 1f;
      this.m_ObjectsFilter = ShadowObjectsFilter.AllObjects;
    }

    public bool Equals(ShadowDrawingSettings other)
    {
      return this.m_CullingResults.Equals(other.m_CullingResults) && this.m_LightIndex == other.m_LightIndex && this.m_SplitData.Equals(other.m_SplitData) && this.m_UseRenderingLayerMaskTest.Equals(other.m_UseRenderingLayerMaskTest) && this.m_ObjectsFilter.Equals((object) other.m_ObjectsFilter);
    }

    public override bool Equals(object obj)
    {
      return obj != null && obj is ShadowDrawingSettings other && this.Equals(other);
    }

    public override int GetHashCode()
    {
      return (int) ((ShadowObjectsFilter) ((((this.m_CullingResults.GetHashCode() * 397 ^ this.m_LightIndex) * 397 ^ this.m_UseRenderingLayerMaskTest) * 397 ^ this.m_SplitData.GetHashCode()) * 397) ^ this.m_ObjectsFilter);
    }

    public static bool operator ==(ShadowDrawingSettings left, ShadowDrawingSettings right)
    {
      return left.Equals(right);
    }

    public static bool operator !=(ShadowDrawingSettings left, ShadowDrawingSettings right)
    {
      return !left.Equals(right);
    }
  }
}
